﻿@using QDT.Common
@model QDT.Common.IPagedList<QDT.Core.Domain.PromoteMsgList>
<div class="main_title">
    推广队列列表
</div>
<div class="button_row">
    <input type="button" class="button" value="彻底删除" onclick=" javascript:deleteMethod('', 'DeletePromoteMsgForever'); ">
	
    <input type="button" id="reset_sending" class="button" value="重置队列发送(队列因卡死，长时间无法发送时请重置)" onclick=" reset_sending('DEAL_MSG_LOCK'); ">
	
</div>
<div class="blank5">
</div>
@using (Html.BeginForm("PromoteQueueList","QueueManagment")) {
    <div class="search_row">
        <label>接收人：</label><input type="text" class="textbox" name="receiver" value="@Request.Params["receiver"]" style="width: 100px;" />
        <label>内容：</label><input type="text" class="textbox" name="content" value="@Request.Params["content"]" />
        <input type="submit" class="button" value="搜索" />
 
    </div>
    <div class="grid_box">
        <div class="grid_top">
        </div>
        @Html.Grid(Model).Columns(column => {
            column.CheckBox(o => o.ID);
            column.For(x => x.ID).Named("编号").SortColumnName("ID");
            column.For(x => x.SendType.ToLocalizable()).Named("发送类型").SortColumnName("SendType");
            column.For(x => x.Dest).Named("接收人").SortColumnName("Dest");
            column.For(x => x.Title).Named("标题").SortColumnName("Title");
            column.For(x => Html.ScriptLink("查看", "show_content({0})", x.ID)).Named("内容").SortColumnName("Content");
            column.For(x => x.CreateTime.ToString("yyyy/MM/dd HH:mm:ss")).Named("创建时间").SortColumnName("CreateTime");
            column.For(x => x.SendTime.ToString("yyyy/MM/dd HH:mm:ss")).Named("发送时间").SortColumnName("SendTime");
            column.For(x => x.IsSend ? "是" : "否").Named("发送状态").SortColumnName("IsSend");
            column.For(x => x.IsSuccess ? "成功" : "失败").Named("结果").SortColumnName("IsSuccess");
            column.For(x => x.Result).Named("信息").SortColumnName("Result");
            column.Buttons(btns => btns.Add(x => Html.ScriptLink("发送", "sendPromoteMsg({0},{1})", x.ID, x.InnerSendType))
                                       .Add(o => Html.ScriptLink("彻底删除", "deleteMethod({0},'{1}')", o.ID, "DeletePromoteMsgForever")));
        }).Complex(ViewData)
        <div class="grid_foot">
        </div>
    </div>
    <div class="blank5">
    </div>
    @Html.Pager(Model)
}
<script type="text/javascript">
    function show_content(id) {
        var url = "/QueueManagment/GetPromoteMsgContent/" + id;
        showAjaxResult(url);
    }

    function sendPromoteMsg(id, type) {
        var url = "";
        //邮件
        if (type == 1) {
            url = "/QueueManagment/SendSinglePromoteMail";
        } else {
            url = "/QueueManagment/SendSinglePromoteMsg";
        }
        $.post(url, { id: id }, function(result) {
            if (result.Status) {
                location.href = location.href;
            }
            customerAlert(null, result.Info);

        });
    }
</script>